<?php
class LogController extends AdminController{
        public function userAction(){
        // Yaf_Dispatcher::getInstance()->disableView();
        $id = Request::asget(3,'id',null);
        $page = Request::asget(3,'page',0);
        if(empty($id)){
            exit;
        }else{
            $model = new UserModel;
            $user = $model->where(['user_id' => $id])->one();
            $this->_view->user = $user;
            if($page == 0){

                $log_model = new UserLogModel;
                $log = $log_model->where(['user_id'=> $id])->limit(30)->select();
                $rows = $log_model->count('user_id');
                // var_dump($rows);
                $this->_view->log = $log;
                $this->_view->rows = $rows;
            }else{
                Yaf_Dispatcher::getInstance()->disableView();
                $log_model = new UserLogModel;
                // Mark...
                $limit = $page*10;
                $log = $log_model->where(['user_id'=> $id])->limit($limit,30)->select();
                $data = [
                    'log' => $log,
                ];
                $html = $this->render('log-tbody',$data);
                echo $html;
            }                
                
        }
    }
}